// import component from './index.vue'
// import Vue from 'vue'
// import router from '@/router'
// import * as auth from '@/utils/auth'
// const Constructor = Vue.extend(component)
// const instance = new Constructor({
//   el: document.createElement('div')
// })
export default {
  show(url, isPage = true, title = '') {
    // title = title || auth.getLocBaseSet().channelName
    const reg =
      /^(((ht|f)tps?):\/\/)[\w-]+(\.[\w-]+)+([\w.,@?^=%&:/~+#-]*[\w@?^=%&/~+#-])?$/
    if (!reg.test(url)) {
      console.log('不是一个正常的地址')
      return
    }
    // if (isPage) {
    //     auth.sLoc.set('url', url)
    //     router.push({ path: '/ZmWebViewPage', query: { title }})
    //     return
    // }
    // this.hide()
    // instance.url = url
    // const el = document.body
    // el.appendChild(instance.$el)
    // instance.show = true
    // window.webview = instance
    window.open(url, '_blank')
  }

  // hide() {
  //   const el = instance.$el
  //   el.parentNode && el.parentNode.removeChild(el)
  //   instance.show = false
  // }
}
